perm filename MIDTER.XGP[F77,JMC]1 blob
sn#312467 filedate 1977-10-27 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30/FONT#1=BAXM30/FONT#2=BAXB30/FONT#3=SUB/FONT#4=SUP/FONT#5=BASL35/FONT#6=NGR25/FONT#7=MATH30/FONT#8=FIX25/FONT#9=GRK30
␈↓ ↓H␈↓CS206␈↓ ¬_MIDTERM EXAMINATION␈↓
0FALL 1977
␈↓ ↓H␈↓␈↓ α_This␈α
examination␈α
is␈α
open␈α
book␈α
and␈α∞notes.␈α
Write␈α
LISP␈α
functions␈α
as␈α
follows␈α∞except␈α
where
␈↓ ↓H␈↓something else is requested. Either notation may be used.
␈↓ ↓H␈↓1. ␈↓↓depth x␈↓ is the length of the longest ␈↓↓car-cdr␈↓ chain reaching an atom in the S-expression ␈↓↓x.␈↓
␈↓ ↓H␈↓2.␈αLet␈α␈↓↓u␈↓␈αbe␈αa␈αlist,␈α␈↓↓f␈↓␈αa␈αfunction␈αon␈αlist␈αelements␈αand␈α␈↓↓p␈↓␈αa␈αpredicate␈αon␈αlist␈αelements.␈α ␈↓↓mapcat[u,f,p]␈↓
␈↓ ↓H␈↓is the obtained by appending elements ␈↓↓f[x]␈↓ of ␈↓↓u␈↓ such that ␈↓↓p[x]␈↓ is satisfied.
␈↓ ↓H␈↓3.␈αLet␈α
␈↓↓g␈↓␈αbe␈α
a␈αdirected␈α
graph␈αin␈α
notation␈αdescribed␈αin␈α
the␈αnotes.␈α
(It␈αis␈α
a␈αlist␈α
of␈αsublists,␈αeach␈α
sublist
␈↓ ↓H␈↓consisting␈αof␈α
a␈αvertex␈α
followed␈αby␈αthe␈α
vertices␈αto␈α
which␈αit␈αis␈α
connected.␈α ␈↓↓component[x,g]␈↓␈α
is␈αa␈αlist␈α
of
␈↓ ↓H␈↓the␈αvertices␈αwhich␈αmay␈αbe␈αreached␈αfrom␈αthe␈αvertex␈α␈↓↓x␈↓␈αby␈αa␈αpath␈αin␈αthe␈αgraph.␈α ␈↓↓bigcomponent[x,g]␈↓
␈↓ ↓H␈↓is a list of all the vertices to which ␈↓↓x␈↓ is connected by any combination of paths.
␈↓ ↓H␈↓4.␈αLet␈α␈↓↓successors␈αx␈↓␈αbe␈αthe␈αlist␈αof␈αsuccessors␈αof␈αan␈αelement␈α␈↓↓x␈↓␈αin␈αsome␈αsearch␈αspace,␈αi.e.␈αthey␈αare␈αthe
␈↓ ↓H␈↓elements␈αof␈αthe␈αspace␈αthat␈αcan␈αbe␈αreached␈αfrom␈α␈↓↓x␈↓␈αin␈αone␈αmove.␈α ␈↓↓bsearch[x,p]␈↓␈αis␈αan␈αelement␈αof␈αthe
␈↓ ↓H␈↓space satisfying the predicate ␈↓↓p␈↓ and at the lowest depth in the tree.